package br.com.farmabid.component;

import javax.enterprise.context.ApplicationScoped;
import javax.enterprise.inject.Specializes;

import br.com.caelum.vraptor.Convert;
import br.com.caelum.vraptor.converter.DoubleConverter;

@Specializes
@Convert(Double.class)
@ApplicationScoped
public class DoubleConversor extends DoubleConverter {

	public Double convert(String string, Class<? extends Double> arg1) {
		if(!StringUteis.isEmpty(string)){
			string = string.replace("R$", "").replace(".", "").replace(",", ".");
			return Double.parseDouble(string);
		} else {
			return null;
		}
	}

}